#!/bin/bash

set -xe

SYMBOL_NICKNAME="${1:-huobi-btcusd-quarter}"
LT_MODEL_VERSION="${2:-1}"

DATETIME="$(date '+%Y%m%d-%H%M%S')"
RESULT_FILE="sim_res/res-${SYMBOL_NICKNAME}-${LT_MODEL_VERSION}-${DATETIME}"
LOG_FILE="sim_res/log-${SYMBOL_NICKNAME}-${LT_MODEL_VERSION}-${DATETIME}"
>&2 echo "Result file: ${RESULT_FILE}"

mkdir -p sim_res

time ./pyrunner coin/experimental/jaewon/research/adaptive_edge/train.py \
  --machine=feed-01.ap-northeast-1.aws \
  --symbol_nickname=${SYMBOL_NICKNAME} \
  --lt_model_version=${LT_MODEL_VERSION} \
  --order_latency=0.5s \
  --order_lifetime=4s \
  2>> ${LOG_FILE}
ls -alh dump_${SYMBOL_NICKNAME}.hd5.lz4 model_${SYMBOL_NICKNAME}.pkl.gz

time ./pyrunner coin/strategy/marketsim/runner.py \
  pass_model_hbdm_btcusd \
  ${SYMBOL_NICKNAME} \
  ${LT_MODEL_VERSION} \
  --num_strategy_per_group=2 \
  --num_cpu=50 \
  > ${RESULT_FILE} \
  2>> ${LOG_FILE}
